<script lang="ts" setup>
import { h, reactive } from 'vue'
const formList = reactive<FormList>([
  {
    label: '单选',
    prop: 'radio1',
    type: 'radio',
    value: '1',
    data: [
      { label: '选项1', value: '1' },
      { label: '选项2', value: '2' },
      {
        label: '选项3',
        value: '3',
        default: c => h('div', { style: { color: 'red' } }, c.label)
      }
    ],
    onChange() {},
    rule: [{ required: true, trigger: 'blur' }]
  },
  {
    label: '按钮',
    prop: 'radio2',
    type: 'radio.button',
    value: '1',
    data: [
      { label: '选项1', value: '1' },
      { label: '选项2', value: '2' },
      { label: '选项3', value: '3' }
    ],
    rule: [{ required: true, trigger: 'blur' }]
  }
])
const submitForm = (formData: any) => {
  console.log(formData)
}
</script>
<template>
  <XyAddForm isCard :formList="formList" @submit-form="submitForm" />
</template>
